#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
  int smallestRangeI(vector<int> &nums, int k) {
    auto q = max_element(nums.begin(), nums.end());
    auto p = min_element(nums.begin(), nums.end());
    int gap = *q - *p;
    if (gap > 2 * k) {
      return gap - 2 * k;
    }
    return 0;
  }
};

int main() {}
